package com.neteast.androidclient.newscenter.util;

import android.content.Context;
import android.os.Bundle;
import android.util.Log;
import android.widget.Button;
import android.widget.Toast;
import com.kaixin.connect.exception.KaixinAuthError;
import com.kaixin.connect.listener.KaixinAuthListener;

public class KaixinHelper {
	
	public static final class KaixinRequestAuthListener implements KaixinAuthListener{
		private Context context;
		private Button button;
		
		public KaixinRequestAuthListener(Context context, Button button) {
			this.context = context;
			this.button = button;
		}

		public void onAuthError(KaixinAuthError kaixinAuthError) {
			Toast.makeText(context, "绑定开心网失败", Toast.LENGTH_SHORT).show();
			Log.i("test", "error="+kaixinAuthError.getErrorDescription());
		}
		
		public void onAuthComplete(Bundle values) {
			Toast.makeText(context, "绑定开心网成功", Toast.LENGTH_SHORT).show();
			button.setText("已绑定");
			button.setEnabled(false);
			Log.i("test", "onAuthComplete");
		}
		
		public void onAuthCancelLogin() {
			Log.i("test", "onAuthCancelLogin");
		}
		
		public void onAuthCancel(Bundle values) {
			Log.i("test", "onAuthCancel");
		}
	}
}
